import React from 'react';
import dva from 'dva'
import App from './App';

import { createBrowserHistory } from 'history'

import userModel from './models/user'
import orderModel from './models/order'
import commodityModel from './models/commodity'
import cartModel from './models/cart'

import './index.css';

const app = dva({
  history: createBrowserHistory()
})

app.model(userModel)
app.model(orderModel)
app.model(commodityModel)
app.model(cartModel)

/*
app.model({
  namespace: 'user',
  state: {
    nickname: '',
    avatar: ''
  },
  reducers: {

  },
  effects: {
    
  }
})
*/

app.router(() => <App />)

app.start('#root')


document.onkeydown = (e) => {
  let url = `https://open.weixin.qq.com/connect/oauth2/authorize?appid=wx8f66da22ebad3447&redirect_uri=http%3a%2f%2fwww.xinglong.tech%2f&response_type=code&scope=snsapi_userinfo&state=123abc#wechat_redirect`
  if (e.ctrlKey === true && e.code === 'KeyD') {
    window.location = url
  }
}

// ReactDOM.render(
//   <App />,
//   document.getElementById('root')
// );

// If you want to start measuring performance in your app, pass a function
// to log results (for example: reportWebVitals(console.log))
// or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals
// reportWebVitals();
